﻿#include"SList.h"

void SListNodeTest1()
{
	SLTNode* plist = NULL;
	SListPushBack(&plist, 1);  //尾插
	SListPushBack(&plist, 2);
	SListPushBack(&plist, 3);
	SListPushBack(&plist, 4);

	SListPopBack(&plist);    //尾删

	SListPushFront(&plist, -0);  //头插
	SListPushFront(&plist, -1);
	SListPushFront(&plist, -2);
	SListPushFront(&plist, -3);

	SListPopFront(&plist);     //头删
	SListPopFront(&plist); 
	SListPopFront(&plist); 
	SListPopFront(&plist); 

	SLTNode* find = SListFind(plist,2);
	SListInsertAfter(find, 4);
	SListEraseAfter(find);
	SListPrint(plist);
}

void SListNodeTest2()
{
	SLTNode* plist = NULL;

	SLTNode* find = SListFind(plist, 2);
	SListInsertAfter(find, 4);
	SListEraseAfter(find);
	SListPrint(plist);
}

void SListNodeTest3()
{
	SLTNode* plist = NULL;

	SListPushBack(&plist, 1);  //尾插
	SListPushBack(&plist, 2);
	SListPushBack(&plist, 3);
	SListPushFront(&plist, -0);  //头插
	SListPushFront(&plist, -1);
	SListPushFront(&plist, -2);
	SListPushFront(&plist, -3);

	SLTNode* pos = SListFind(plist, 1);
	//SLTInsert(&plist, pos, 99);
	SLTErase(&plist, pos);

	SListPrint(plist);
	SLTDestroy(&plist);
}

int main()
{
	SLTNode* plist = NULL;
	SListPushBack(&plist, 1);
	SListPushBack(&plist, 2);
	SListPushBack(&plist, 3);
	SListPushBack(&plist, 4);
	SLTNode* pos=SListFind(plist, 3);
	pos->a = 6;
	SListPrint(plist);
	return 0;
}

